home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
H-I
/
HyperHackers.cpt
/
Hyper-Hackers Queue 1.0
/
card_36874.txt
< prev
next >
Wrap
Text File
|
1989-02-26
|
4KB
|
112 lines
-- card: 36874 from stack: in.0
-- bmap block id: 0
-- flags: 0000
-- background id: 3797
-- name:
-- part contents for background part 1
----- text -----
From: edmoy@violet.berkeley.edu
Date: 10 Mar 88 19:28:34 GMT
>I want to copy the contents in fields of one stack to an updated version
>new stack. I used a script like the one here...
>on copyStuff - executed from a button in the source stack
> put the number of cards into numCards
> repeat with i = 1 to numCards
> go card i of stack "sourceStack"
> put field "f1" into f1contents
> - and so on
>
> go stack "destination" - has one card to begin with, with fields, etc
> if i > the number of cards then
> doMenu "New Card"
> end if
>
> go card i
>
> put f1contents into field "f1" - fields have same names
> - and so on
>
> end repeat
>end copyStuff
I think the problem is that when you do go stack "destination" and make the
new card, the card goes after the current card (the current card being the
first card when just entering the stack). Then you go to the i'th card,
but that isn't the one you just created.
One way to fix the problem is to:
go last card of stack "destination"
if i > the number of cards then
doMenu "New Card"
end if
put f1contents into field "f1"
I have a stack that is used by a group of consultants here at the computer
center. I've had to update the stack ump-teen times so I had a similar
problem to yours. I didn't want to have to go between stacks on each
card, because of the additional overhead of opening and closing stacks.
What I did was to write a text file having the information of the source
stack, then go to the destination stack and read the stuff back in. The
code looked something like:
- This is all from memory so if the syntax is a little off, forgive me
on dump
open file "Temp File"
put tab into fieldSeparator
put return into cardSeparator
go first card
repeat with i = 1 to the number of cards
get field "f1" && fieldSeparator && field "f2" && cardSeparator
write it to file "Temp File"
go next card
end repeat
close file "Temp File"
end dump
on restore
open file "Temp File"
put tab into fieldSeparator
put return into cardSeparator
read file "Temp File" until cardSeparator
repeat until it is empty
doMenu "New Card"
put offset(fieldSeparator,it) into endOfRecord
if endOfRecord > 1
then put char 1 to (endOfRecord - 1) of it into field "f1"
delete char 1 to endOfRecord of it
put offset(fieldSeparator,it) into endOfRecord
if endOfRecord > 1
then put char 1 to (endOfRecord - 1) of it into field "f2"
read file "Temp File" until cardSeparator
end repeat
close file "Temp File"
end restore
I would do "dump" in the source stack and then go to the destination stack
and do "restore". In my stack, I had some 20 fields and it took about
6-8 seconds to write out each card and about 1-2 seconds to read it back
in.
I eventually wanted the intermediate output to be a way to transfer data
to Unix systems, where I have a simple program that can create and edit
the data which could be read into the stack. This made it considerable
more complicated and (for some reason) writing it out took 2-4 seconds
and reading it back in took 6-10 seconds (it has to recognize various
key words, since the fields could come in any order). This was much
too slow for what I had to do. I finally wrote an XFCN that did the
same thing in C, and now it takes a second or less to write out a card,
and a second or two to read it back in.
-- part contents for background part 45
----- text -----
Re: Copying contents of stacks